<?php
include($_SERVER['DOCUMENT_ROOT']. '/fatec-si/controllers/evento.php');
include($_SERVER['DOCUMENT_ROOT']. '/fatec-si/utils/config.php');

	$target_path = "../uploads/";
	$target_path = $target_path . basename( $_FILES['arquivo']['name']); 

	if(move_uploaded_file($_FILES['arquivo']['tmp_name'], $target_path)) {
    	
		$evento  =  new EventoController();
        $data = array(
				'id_processo'=>$_POST["id_processo"],
				 'nome'=>$_POST["nome"],
				'data_inicio'=>$_POST["data_inicio"],
				'data_proximo'=>$_POST["data_proximo"],
				'documento_caminho'=>"<a target='_blank' href='../uploads/{$_FILES['arquivo']['name']}'>{$_FILES['arquivo']['name']}");
        $evento->salvar($data);
	} else{
    	echo "0";
	}
	
?>
